﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace LunchLearn.WebApi.Domain
{
    public class Order
    {
        public int Id { get; set; }
        public int CustomerId { get; set; }
        public Guid ReferenceId { get; set; }
        public virtual Customer Customer { get; set; }
        public bool IsActive { get; set; }
        public float TotalAmount
        {
            get { return OrderLines != null ? OrderLines.ToList().Sum(x => x.TotalAmount) : 0; }
        }

        public float TotalPaid { get; set; }
        public DateTime CreationDate { get; set; }
        public DateTime? ModifiedDate { get; set; }
        public virtual IList<OrderLine> OrderLines { get; set; }
        public bool IsPending { get; set; }
    }
}
